package com.uzai.console.service.feign.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uzai.common.result.ResponseCode;
import com.uzai.console.common.UzaiRespVo;
import com.uzai.console.dto.md.mdgoods.ExemptionGoodsQuery;
import com.uzai.console.dto.md.mdgoods.ExemptionGoodsUpdateRedeemedQuantityDto;
import com.uzai.console.dto.md.mdgoods.MdGoodsQuery;
import com.uzai.console.dto.pyq.llygoods.PyqLlyGoodsUserIdDto;
import com.uzai.console.dto.pyq.llygoods.PyqLlyGoodsUserQuery;
import com.uzai.console.entity.MdGoods;
import com.uzai.console.service.feign.UzaiBusinessFeignService;
import com.uzai.console.service.feign.dto.GoodsUpdateExposureNumBySendPyqDto;
import com.uzai.console.service.feign.dto.LlyGoodsPageDto;
import com.uzai.console.service.feign.dto.StopGoodsDto;
import com.uzai.console.vo.md.exemptiongoods.ExemptionGoodsVo;
import com.uzai.console.vo.pyq.llygoods.PyqLlyGoodsUserVo;
import com.uzai.console.vo.pyq.llygoods.PyqLlyGoodsVo;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Auther: lucher
 * @Date: 2022/3/30 17:26
 * @Description:
 */
@Component
public class UzaiBusinessFallbackFactory implements FallbackFactory<UzaiBusinessFeignService> {
    private static Logger logger = LoggerFactory.getLogger(UzaiBusinessFallbackFactory.class);
    @Override
    public UzaiBusinessFeignService create(Throwable throwable) {

        return new UzaiBusinessFeignService() {
            @Override
            public UzaiRespVo<Page<PyqLlyGoodsVo>> goodsSelectByPage(LlyGoodsPageDto llyGoodsPageDto) {
                UzaiRespVo<Page<PyqLlyGoodsVo>> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<PyqLlyGoodsVo> goodsSelectById(@RequestBody LlyGoodsPageDto llyGoodsPageDto){
                UzaiRespVo<PyqLlyGoodsVo> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<PyqLlyGoodsVo> goodsSelectByNewest(@RequestBody LlyGoodsPageDto llyGoodsPageDto){
                UzaiRespVo<PyqLlyGoodsVo> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> updateExposureNumBySendPyq(@RequestBody GoodsUpdateExposureNumBySendPyqDto goodsUpdateExposureNumBySendPyqDto){
                UzaiRespVo<Object> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(false);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Integer> selectBaseExposureNum(){
                UzaiRespVo<Integer> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> stopGoods(StopGoodsDto stopGoodsDto){
                UzaiRespVo<Object> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Page<PyqLlyGoodsUserVo>> goodsUserFindByPage(PyqLlyGoodsUserQuery pyqLlyGoodsUserQuery){
                UzaiRespVo<Page<PyqLlyGoodsUserVo>> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<PyqLlyGoodsUserVo> goodsUserSelectById(PyqLlyGoodsUserIdDto pyqLlyGoodsUserIdDto){
                UzaiRespVo<PyqLlyGoodsUserVo> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Page<ExemptionGoodsVo>> findPageByMdExemptionGoods(ExemptionGoodsQuery exemptionGoodsQuery){
                UzaiRespVo<Page<ExemptionGoodsVo>> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> updateExemptionGoodsRedeemedQuantity(ExemptionGoodsUpdateRedeemedQuantityDto exemptionGoodsUpdateRedeemedQuantityDto){
                UzaiRespVo<Object> uzaiRespVo= new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

        };

    }
}
